<!DOCTYPE html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  
 </head>
 <body>
  <script>
var str = 'abcdefg';
console.log(str.substr(1, 3))	//返回bcd
console.log(str.substr(2))  	//返回cdefg
console.log(str.substr(-2, 4))	//返回fg，如果目标长度较大，则以实际截取的长度为准

  </script>
 </body>
</html>
